//
//  TwoHeaderView.m
//  Vest_native
//
//  Created by WangZhenyu on 2017/10/5.
//  Copyright © 2017年 WangZhenyu. All rights reserved.
//

#import "FormalThreeHeaderView.h"
#import "AppDelegate.h"
#import "WebShowViewController.h"

@interface FormalThreeHeaderView(){
    NSDictionary *toolsConfig;
}

@property (weak, nonatomic) IBOutlet UIImageView *bannerImageView;
@property (weak, nonatomic) IBOutlet UIView *bottomView;

@end

@implementation FormalThreeHeaderView

- (id)initItem{
    self = [[[NSBundle mainBundle] loadNibNamed:@"FormalThreeHeaderView" owner:self options:nil] lastObject];
    if (self) {
        
        
        float bannerHeight = 120 * SCREEN_SCALE;
        [self.bannerImageView setFrame:CGRectMake(0, 0, SCREEN_WIDTH_DEVICE, bannerHeight)];
        
        [self.bottomView setFrame:CGRectMake(0, bannerHeight + 10, SCREEN_WIDTH_DEVICE, 136)];
        
        [self setFrame:CGRectMake(0, 0, SCREEN_WIDTH_DEVICE, bannerHeight + 10 + 136)];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickBanner)];
        tap.numberOfTapsRequired = 1;
        [self.bannerImageView addGestureRecognizer:tap];
    }
    return self;
}

- (void)setContentConfig:(NSDictionary *)dic{
    toolsConfig = dic;
}

- (void)clickBanner{
    AppDelegate *del = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    [del.navigationController.topViewController showHUDAlert:@"敬请期待，感谢您的支持"];
}

- (IBAction)problemPress {
    WebShowViewController *viewCon = [[WebShowViewController alloc] initWithNibName:@"WebShowViewController" bundle:nil];
    viewCon.urlStr = [toolsConfig objectForKey:@"remenwenti"];
    AppDelegate *del = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    [del.navigationController pushViewController:viewCon animated:YES];
}

- (IBAction)gonglvPress {
    WebShowViewController *viewCon = [[WebShowViewController alloc] initWithNibName:@"WebShowViewController" bundle:nil];
    viewCon.urlStr = [toolsConfig objectForKey:@"daikuangonglve"];
    AppDelegate *del = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    [del.navigationController pushViewController:viewCon animated:YES];
}

@end
